package com.ztman.rxjava.mvp.viewProxy;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.ztman.rxjava.R;
import com.ztman.rxjava.mvp.view.BaseViewActivityIml;
import com.ztman.rxjava.view.activity.MainActivity;
import com.ztman.rxjava.view.activity.SelfInfoActivity;
import com.ztman.rxjava.view.activity.UploadFileActivity;
import com.ztman.rxjava.view.activity.WeatherActivity;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by YJH on 2017/11/30.
 * 功能：MainActivity-已经实体化的逻辑功能处理的代理类
 */

public class MainActivityProxy extends BaseViewActivityIml  {
    @Bind(R.id.tSelf)
    TextView tSelf;
    @Bind(R.id.tWeather)
    TextView tWeather;
    @Bind(R.id.tUpLoad)
    TextView tUpLoad;
    @Bind(R.id.tPermission)
    TextView tPermission;

    private MainActivity mMainActivity;
    @Override
    public int getLayoutIdInBaseView() {
        return R.layout.activity_main;
    }


    /**
     * 功能：注册aty进来
     * 这个方法要在 使用到aty对象的所有操作之前
     * @param mMainActivity
     */
    public void register(MainActivity mMainActivity){
        this.mMainActivity = mMainActivity;
    }

    @OnClick({R.id.tSelf, R.id.tWeather, R.id.tUpLoad})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tSelf:
                goActivity(SelfInfoActivity.class);
                break;

            case R.id.tWeather:
                goActivity(WeatherActivity.class);
                break;

            case R.id.tUpLoad:
                goActivity(UploadFileActivity.class);
                break;
        }
    }

    private void goActivity(Class<?> cls) {
        Intent itent = new Intent(mMainActivity, cls);
        mMainActivity.startActivity(itent);
    }





}
